package main.java.com.cooljie.service;

import com.cooljie.dao.StudentMapper;
import com.cooljie.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by ACER on 2017/5/22.
 */

@Service("StudentService")
public class StudentServiceImpl implements StudentService {
    @Autowired  StudentMapper studentMapper;


    public Student findStudentById(Integer id) {
        return studentMapper.selectByPrimaryKey(id);
    }

    @Override
    public Integer deleteById(Integer id) {
        return studentMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insertData(Student student) {
        return studentMapper.insertSelective(student);
    }

    @Override
    public int updateStudent(Student student) {
        return studentMapper.updateByPrimaryKey(student);
    }

    @Override
    public List<Student> selectStudentByPage(Integer pageOffset, Integer pageSize) {
        return studentMapper.selectStudentByPage(pageOffset,pageSize);
    }

    @Override
    public int allPages() {
        return studentMapper.allPages();
    }

    @Override
    public int selectAllPages(String sno, String name) {
        return studentMapper.selectAllPages(sno,name);
    }

    @Override
    public List<Student> search(String sno, String name,Integer pageOffset,Integer pageSize) {
        return studentMapper.search(sno,name,pageOffset,pageSize);
    }
}

